﻿const {Card, Button, Input, Select, Icon, TreeSelect, DatePicker, Row, Col, Checkbox} = antd;
const {MonthPicker, RangePicker} = DatePicker;
const InputGroup = Input.Group;
const Option = Select.Option;
const TreeNode = TreeSelect.TreeNode;

class HeaderBox extends React.Component {
    state = {
        project: true
    };
    constructor(props) {
        super(props);
        // var _this = this;
        //
        // JobProject.map(function (target, index) {
        //     if (vui.GetCookie("ProjectId") != null) {
        //         if (vui.GetCookie("ProjectId") == target.id) {
        //             _this.state.projectValue = target.text
        //         }
        //     }
        // })
        // UserProductJob.map(function (target, index) {
        //     if (vui.GetCookie("JobID") != null) {
        //         if (vui.GetCookie("JobID") == target.ID) {
        //             _this.state.jobValue = target.JobName
        //         }
        //     }
        // })
        // if (props.project == false) {
        //     _this.state.project = false;
        // }

    }
    logOut = () => {
        vui.Cookie({ name: 'OrgID', value: "", expires: -1 });
        vui.Cookie({ name: 'ProductID', value: "", expires: -1 });
        vui.Cookie({ name: 'SCAppID', value: "", expires: -1 });
        vui.Data.getFuncData({
            funcid: "UserLogout_Insert",
            param: { UserName: User.UserName },
            success: function (res) {
                window.location.href = "/FrameWeb/FrameView/Login/Login.html";
            }
        });
        //window.location.href = "/FrameWeb/FrameView/Login/Login.html";
    }
    selectOnChange = (value, label, extra) => {
        if (extra.triggerNode) {
            vui.Cookie(
                { name: "ProjectId", value: extra.triggerNode.props.eventKey }
            )
        }
        this.setState({ projectValue: value });
        if (value != undefined) {
            location.reload();
        }
    }
    selectOnChangeJob = (value, label, extra) => {
        if (extra.triggerNode) {
            vui.Cookie(
                { name: "JobID", value: extra.triggerNode.props.eventKey }
            )
        }
        this.setState({ jobValue: value });
        if (value != undefined) {
            location.reload();
        }
    }
    render() {
        return (
            <header className="header_vl">
                {/*<img className="top_bg" src="/Skin/Green/images/header_topBg.png" alt="" />*/}
                <img className="top_bg" src="../../Skin/Green/images/header_topBg.png" alt="" />
                <div className="top_content">
                    <div className="header_logo_box">
                        {/*<img className="header_logo" src="/Skin/Green/images/header_logo.png" alt="" />*/}
                        <img className="header_logo" src="../../Skin/Green/images/header_logo.png" alt="" />
                    </div>
                    <div className="header_nav_box">
                        {/*{CurrMenu?CurrMenu.MenuName:''}*/}
                    </div>
                    <div className="header_view">
                        <div className="header_view_content">
                            <div className="header_view_bottom">
                                {/*<div className="header_view_bottom_right mt_20">*/}
                                    {/*{*/}
                                        {/*this.state.project ? <div className="header_project_box">*/}
                                            {/*<SelectProject selectOnChange={this.selectOnChange.bind(this)} value={this.state.projectValue} />*/}
                                        {/*</div> : ""*/}
                                    {/*}*/}
                                    {/*<div className="header_job_box">*/}
                                        {/*<SelectJob selectOnChange={this.selectOnChangeJob.bind(this)} value={this.state.jobValue} />*/}
                                    {/*</div>*/}
                                    {/*<div className="clearfix">*/}
                                        {/*<span idName="username" className="cl666 fl ml_5 f14"> {User.EmployeeName}</span>*/}
                                        {/*<Popconfirm placement="bottomRight" title={logOutMsg.title} onConfirm={this.logOut} okText={logOutMsg.okText} cancelText={logOutMsg.cancelText}>*/}
                                            {/*<span className="icon-headerclose fl mt_3 ml_5" ></span>*/}
                                        {/*</Popconfirm>*/}

                                    {/*</div>*/}
                                {/*</div>*/}
                            </div>
                        </div>
                    </div>
                </div>
            </header>
        );
    }
}